<?php
namespace app\index\controller;
use think\Db;
class News extends Base{
    public function news(){
    	$news_banner=Db::name('news_banner')->where('id',1)->find();
        $express=Db::name('express_style')->order('id asc')->select();
        $top_news=Db::name('news')->where('state',1)->where('top',1)->find();
        $news=Db::name('news')->where('state',1)->order('id desc')->paginate(10);
        $this->assign('system_set',$this->system_set());
		$this->assign('news_banner',$news_banner);
        $this->assign('express',$express);
        $this->assign('top_news',$top_news);
        $this->assign('news',$news);
        return $this->fetch();
    }
    public function newsdetail()
    {
        $id=input("param.id");
        $news_banner=Db::name('news_banner')->where('id',1)->find();
        $express=Db::name('express_style')->order('id asc')->select();
        $newsdetail=Db::name('news')->where('id',$id)->find();
        $pre=Db::name('news')->where('id','<',$id)->where('state',1)->find();
        $next=Db::name('news')->where('id','>',$id)->where('state',1)->order('id desc')->find();
        $this->assign('system_set',$this->system_set());
        $this->assign('news_banner',$news_banner);
        $this->assign('express',$express);
        $this->assign('newsdetail',$newsdetail);
        $this->assign('pre',$pre);
        $this->assign('next',$next);
        return $this->fetch();
    }
    public function trends(){
        $news_banner=Db::name('news_banner')->where('id',1)->find();
        $express=Db::name('express_style')->order('id asc')->select();
        $top_news=Db::name('industry_news')->where('state',1)->where('top',1)->find();
        $news=Db::name('industry_news')->where('state',1)->order('id desc')->paginate(10);
        $this->assign('system_set',$this->system_set());
        $this->assign('news_banner',$news_banner);
        $this->assign('express',$express);
        $this->assign('top_news',$top_news);
        $this->assign('news',$news);
        return $this->fetch();
    }
    public function trendsdetail()
    {
        $id=input("param.id");
        $news_banner=Db::name('news_banner')->where('id',1)->find();
        $express=Db::name('express_style')->order('id asc')->select();
        $trendsdetail=Db::name('industry_news')->where('id',$id)->find();
        $pre=Db::name('industry_news')->where('id','<',$id)->where('state',1)->find();
        $next=Db::name('industry_news')->where('id','>',$id)->where('state',1)->order('id desc')->find();
        $this->assign('system_set',$this->system_set());
        $this->assign('news_banner',$news_banner);
        $this->assign('express',$express);
        $this->assign('trendsdetail',$trendsdetail);
        $this->assign('pre',$pre);
        $this->assign('next',$next);
        return $this->fetch();
    }
    public function delivery(){
        $news_banner=Db::name('news_banner')->where('id',1)->find();
        $express=Db::name('express_style')->order('id asc')->select();
        $news=Db::name('express_news')->where('state',1)->order('id desc')->paginate(10);
        $this->assign('system_set',$this->system_set());
        $this->assign('news_banner',$news_banner);
        $this->assign('express',$express);
        $this->assign('news',$news);
        return $this->fetch();
    }
    public function deliverydetail()
    {
        $id=input("param.id");
        $news_banner=Db::name('news_banner')->where('id',1)->find();
        $express=Db::name('express_style')->order('id asc')->select();
        $deliverydetail=Db::name('express_news')->where('id',$id)->find();
        $pre=Db::name('express_news')->where('id','<',$id)->where('state',1)->find();
        $next=Db::name('express_news')->where('id','>',$id)->where('state',1)->order('id desc')->find();
        $this->assign('system_set',$this->system_set());
        $this->assign('news_banner',$news_banner);
        $this->assign('express',$express);
        $this->assign('deliverydetail',$deliverydetail);
        $this->assign('pre',$pre);
        $this->assign('next',$next);
        return $this->fetch();
    }
}
